<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    <link rel="stylesheet"
          href="https://cdn.bootcss.com/bootstrap/4.0.0-beta/css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
    <script
            src="https://cdn.bootcss.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
    <style>
        .imgs {
            width: 900px;
            height: 400px;
            background-position: center;
            background-size: cover;
        }
        body {
            background-image: url("<%=request.getContextPath()%>/img/background2.jpg");
            background-repeat: no-repeat; /*设置背景不重复*/
            background-attachment: fixed; /*背景图片不会随着页面的滚动而滚动。*/
            background-size: cover; /*	此时会保持图像的纵横比并将图像缩放成将完全覆盖背景定位区域的最小大小。*/
            /*opacity: 0.5设置透明度*/
        }

    </style>
    <script type="text/javascript">
        function doDelete(userid) {
            /* 如果这里弹出的对话框，用户点击的是确定，就马上去请求Servlet。
            如何知道用户点击的是确定。
            如何在js的方法中请求servlet。 */
            var flag = confirm("是否确定删除?");
            if (flag) {
                //表明点了确定。 访问servlet。 在当前标签页上打开 超链接，
                //window.location.href="DeleteServlet?sid="+sid;
                location.href = "DeleteServlet?Userid=" + userid;
            }
        }
    </script>
</head>
<%--<body background="<%=request.getContextPath()%>/img/background2.jpg">--%>
<body>
<h2 align="center" style="margin-top: 20px;">网吧管理系统</h2>
<div>
    <div class="row " style="margin-top: 50px;">
        <div align="center" class="col-md-3">
            <ul class="list-group">
                <li class="list-group-item "><a href="<%=request.getContextPath() %>/Super/Super_about.jsp"><span
                        style="color: black">首页</span></a></li>
                <li class="list-group-item active "><a href="<%=request.getContextPath() %>/UserListServlet"><span
                        style="color: black">用户会员管理</span></a></li>
                <li class="list-group-item  "><a href="<%=request.getContextPath() %>/ChongzhiListServlet"><span
                        style="color: black">充值列表</span></a></li>
                <li class="list-group-item  "><a href="<%=request.getContextPath() %>/Super/Super_AddUser.jsp"><span
                        style="color: black">添加用户</span></a></li>
                <li class="list-group-item  "><a
                        href="<%=request.getContextPath() %>/Super/OnetimeCardChongzhi.jsp"><span
                        style="color: black">临时卡充值</span></a></li>
                <li class="list-group-item  "><a href="<%=request.getContextPath() %>/TodayStatistics"><span
                        style="color: black">当日收入清单</span></a></li>
                <li class="list-group-item  "><a href="<%=request.getContextPath() %>/MonthStatisticsServlet"><span
                        style="color: black">当月收入清单</span></a></li>
                <li class="list-group-item  "><a href="<%=request.getContextPath() %>/Super/Super_exit.jsp"><span
                        style="color: black">退出</span></a></li>
            </ul>
        </div>
        <div class="col-md-9">
            <div style="display: flex">
                <form action="<%=request.getContextPath()%>/SearchUsernameServlet" method="post" style="display: flex">
                    <td>
                        <input type="text" name="username" placeholder="请输入用户名"
                               style=" margin-top: 10px;"
                               class="form-control inputclass">
                    </td>
                    <button type="submit"
                            class="btn btn-info" style="height: 38px;margin-top: 10px;">查询
                    </button>
                </form>
<%--                <form action="<%=request.getContextPath()%>/SearchDengjiServlet" method="post" style="display: flex">--%>
<%--                    <td>--%>
<%--                        <select name="dengji" style="margin-left: 50px; margin-top: 10px;" class="form-control inputclass">--%>
<%--                            <option value="白银会员">白银会员</option>--%>
<%--                            <option value="黄金会员">黄金会员</option>--%>
<%--                            <option value="铂金会员">铂金会员</option>--%>
<%--                        </select>--%>
<%--                    </td>--%>
<%--                    <button type="submit"--%>
<%--                            class="btn btn-info" style="height: 38px;margin-top: 10px;">查询--%>
<%--                    </button>--%>
<%--                </form>--%>
                <form action="<%=request.getContextPath()%>/SearchPhoneServlet" method="post" style="display: flex">
                    <td>
                        <input type="text" name="phone"  placeholder="请输入手机号"
                               style="margin-left: 50px; margin-top: 10px;"
                               class="form-control inputclass">
                    </td>
                    <button type="submit"
                            class="btn btn-info" style="height: 38px;margin-top: 10px;">查询
                    </button>
                </form>
            </div>
            <table class="table table-bordered">
                <tr style="text-align: center;" >
                    <td>用户id</td>
                    <td>用户名</td>
                    <td>密码</td>
                    <td>生日</td>
                    <td>性别</td>
                    <td>用户类型</td>
                    <td>总充值金额</td>
                    <td>已消费金额</td>
                    <td>未消费金额</td>
                    <td>会员等级</td>
                    <td>手机号</td>
                    <td>入会日期</td>
                    <td style="width:100px;">操作</td>
                </tr>

                <c:forEach items="${pageBean.list }" var="users">
                    <tr align="center">
                        <td>${users.userid }</td>
                        <td>${users.username }</td>
                        <td>${users.passwords }</td>
                        <td>${users.birthday }</td>
                        <td>${users.sex }</td>
                        <td>
                            <c:if test="${users.usertype == 1}">会员</c:if>
                            <c:if test="${users.usertype == -1}">系统管理员</c:if>
                        </td>
                        <td>${users.money }</td>
                        <td>${users.yxf }</td>
                        <td>${users.wxf }</td>
                        <td>${users.dengji }</td>
                        <td>${users.phone }</td>
                        <td>${users.rhtime }</td>
                        <td>
                            <a href="EditUserController?userid=${users.userid }">更新</a>
                            <a href="#" onclick="doDelete(${users.userid})">删除</a>
                            <a href="UserDetailServlet?userid=${users.userid}&usertype=${sessionScope.usertype}">充值</a>
                            <a href="UserBaofangServlet?userid=${users.userid}">包房</a>
                            <a href="UserKaijiServlet?userid=${users.userid}">开机</a>
                            <a href="SuperVipTuifeiServlet?userid=${users.userid}">退费</a>
                        </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="9">
                        第 ${pageBean.currentPage } / ${pageBean.totalPage }
                        &nbsp;&nbsp;
                        每页显示${pageBean.pageSize }条 &nbsp;&nbsp;&nbsp;
                        总的记录数&nbsp;&nbsp;(${pageBean.totalSize }) &nbsp;&nbsp;&nbsp;
                        <c:if test="${pageBean.currentPage !=1 }">
                            <a href="UserListServlet?currentPage=1">首页</a>
                            | <a href="UserListServlet?currentPage=${pageBean.currentPage-1 }">上一页</a>
                        </c:if>
                        <c:forEach begin="1" end="${pageBean.totalPage }" var="i">
                            <c:if test="${pageBean.currentPage == i }">
                                ${i}
                            </c:if>
                            <c:if test="${pageBean.currentPage != i }">
                                <a href="UserListServlet?currentPage=${i}">${i }</a>
                            </c:if>
                        </c:forEach>
                        <c:if test="${pageBean.currentPage !=pageBean.totalPage }">
                            <a href="UserListServlet?currentPage=${pageBean.currentPage+1 }">下一页</a> |
                            <a href="UserListServlet?currentPage=${pageBean.totalPage }">尾页</a>
                        </c:if>
                    </td>
                </tr>
            </table>

            <nav class="text-center">
                <ul class="pagination">
                    <!-- 上一页 -->
                    <li class="page-item"><a href="UserListServlet?currentPage=${pageBean.currentPage-1 }"
                                             class="page-link"
                                             aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
                    </a></li>
                    <!-- 页码 -->
                    <!-- 下一页 -->
                    <li class="page-item"><a href="UserListServlet?currentPage=${pageBean.currentPage+1 }"
                                             class="page-link"
                                             aria-label="Next"> <span aria-hidden="true">&raquo;</span>
                    </a></li>
                </ul>
            </nav>
<%--            <a href="Super/Super_AddUser.jsp" class="btn btn-default"><span>添加单个用户</span></a>--%>
        </div>
    </div>
</div>
<%--<jsp:include page="Super_footer.jsp"></jsp:include>--%>
</body>
</html>